package com.registration.service;

import com.registration.bean.MenuBean;
import com.registration.mapper.MenuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;


@Service
public class MenuServiceImpl implements MenuService{
    @Autowired
    MenuMapper menuMapper;


    @Override
    public List<MenuBean> getMenuList(Integer menu_id) {
        return menuMapper.getMenuList(menu_id);
    }

    @Override
    public List<MenuBean> getMenuListByPCUserId(Integer pc_user_id) {
        List<MenuBean> menuListAll = menuMapper.getMenuListByPCUserId(pc_user_id);

        List<MenuBean> menuList = new ArrayList<>();
        for(MenuBean menuBean:menuListAll){
            if(menuBean.getParent_id()==1){
                menuList.add(menuBean);
            }
        }

        return menuList;
    }
}
